function getPaste(file, id, overwrite)
 if overwrite and fs.exists(file) and string.find(file, "system/") then
  if fs.exists("/etc/.backups/"..file) then
   fs.delete("/etc/.backups/"..file)
  end
  fs.copy(file, "/etc/.backups/"..file)
 end
 return kernel.getFile(file, "http://pastebin.com/raw/"..id, overwrite)
end

function downloadAPI(filename, id)
 return getPaste("/usr/local/lib/"..filename, id, true)
end

function downloadBinary(filename, id)
 return getPaste("/usr/local/bin/"..filename, id, true)
end

function toPackageAPI(filename)
 return "/usr/local/lib/"..filename
end

function toPackageBinary(filename)
 return "/usr/local/bin/"..filename
end